<?php

namespace app\admin\service;

use app\admin\dao\MemberDao;
use app\admin\model\UM as UM;
use ShidianUtil\Utils\TimeUtil;
use think\Collection;

/**
 * Class LawyerExportService
 * @package app\admin\service
 */
class LawyerExportService
{
    // dao
    private MemberDao $memberDao;

    public function __construct(MemberDao $memberDao)
    {
        $this->memberDao = $memberDao;
    }

    /**
     *
     * @param UM|null $user
     * @param $startTime
     * @param $endTime
     * @return Collection
     */
    public function index(?UM $user, $startTime, $endTime): Collection
    {
        if (is_numeric($endTime)) {
            $endTime = TimeUtil::stamp(TimeUtil::DAY, $endTime, false);
        }
        return $this->memberDao->selectForExport($startTime, $endTime);
    }

    public function indexBalance(?UM $user, $card_balance): Collection
    {
        return $this->memberDao->selectForBalanceExport($card_balance);
    }


}
